﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CE.AreaCountry;
using CE.Global;
using CE.TravelInsurance;

public partial class Admin_travel_insurance_AddTravelInsurance : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] == null)
        {
            Response.Redirect("~/Admin/AdminSecureLogin.aspx");
        }

        if (!Page.IsPostBack)
        {
            LoadCompany();
            LoadRegion();
            
            Int64 _taid;
            string _covertype;
            if ((Request.Params["TAId"] != null) && (Request.Params["Cov"] != null))
            {                
                if (Int64.TryParse(Request.Params["TAId"].ToString(), out _taid))
                {
                    _covertype = Request.Params["Cov"].ToString();
                    ShowTADetails(_taid, _covertype);
                    LoadAgeEligibility();
                }
            }
            else
                clearProcess();


            if (lblTAId.Text.Trim() != "0")
            {
                pnlAge.Visible = true;
                pnlPremium.Visible = true;
                pnlAreaDDL.Visible = true;
                ddlPolicyType.Enabled = false;
            }
            else
            {
                pnlAge.Visible = false;
                pnlPremium.Visible = false;
                pnlAreaDDL.Visible = false;
                ddlPolicyType.Enabled = true;
            }
        }

    
    }

    private void LoadCompany()
    {
        DataTable _dtCompany = General.GetComboItem("ProviderCompany", false);
        _dtCompany.DefaultView.Sort = "CompanyName asc";

        ddlProviderCompanyName.DataSource = _dtCompany.DefaultView.Table;
        ddlProviderCompanyName.DataTextField = _dtCompany.Columns[0].ColumnName.ToString();
        ddlProviderCompanyName.DataValueField = _dtCompany.Columns[1].ColumnName.ToString();
        ddlProviderCompanyName.DataBind();

        ddlProviderCompanyName.Items.Insert(0, new ListItem("Select", "-1"));
    }

    private void LoadRegion()
    {
        DataTable _dtRegion = General.GetComboItem("RegionArea", false);
        ddlAreaRegion.DataSource = _dtRegion;
        ddlAreaRegion.DataTextField = _dtRegion.Columns[0].ColumnName.ToString();
        ddlAreaRegion.DataValueField = _dtRegion.Columns[1].ColumnName.ToString();
        ddlAreaRegion.DataBind();

        ddlAreaRegion.Items.Insert(0, new ListItem("Select", "-1"));
    }
   
    protected void btnClear_Click(object sender, EventArgs e)
    {
        clearProcess();
    }

    protected void btnBack_Click(object sender, EventArgs e)
    {
        Response.Redirect("ViewTravelInsurance.aspx");
    }
       
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            TAQuoteResult _tainfo = new TAQuoteResult();
            TAQuoteResultDB _tainfodb = new TAQuoteResultDB();
          
            _tainfo.TAInsId = Convert.ToInt64(lblTAId.Text.Trim());
            _tainfo.TACompanyId = Convert.ToInt32(ddlProviderCompanyName.SelectedValue);
            _tainfo.InsurerName = ddlProviderCompanyName.SelectedItem.Text;
            _tainfo.PlanName = txtPlanName.Text.Trim();
            _tainfo.PlanType = ddlPolicyType.SelectedValue;
            //_tainfo.TripType = ddlTripType.SelectedValue;
            _tainfo.TripType = "S";
            _tainfo.CoverageLevel = ddlLevelOfCoverage.SelectedValue;
            //_tainfo.AnnualPremium = Convert.ToSingle(txtAnnualPremium.Text.Trim());
            _tainfo.DTPD_LessYr70 = Convert.ToInt32(txtAdultLess70.Text.Trim());
            _tainfo.DTPD_AboveYr70 = Convert.ToInt32(txtAdultAbove70.Text.Trim());
            _tainfo.DeathPubTrans = Convert.ToInt32(txtDFPT.Text.Trim());
            _tainfo.Bereavement = Convert.ToInt32(txtBereavement.Text.Trim());
            _tainfo.MedExp_LessYr70 = Convert.ToInt32(txtMedExpLess70.Text.Trim());
            _tainfo.MedExp_AboveYr70 = Convert.ToInt32(txtMedExpAbove70.Text.Trim());
            _tainfo.EmMedEval = Convert.ToInt32(txtEmergencyMed.Text.Trim());
            _tainfo.HospIncome = Convert.ToInt32(txtHospitalInc.Text.Trim());
            _tainfo.BCR = Convert.ToInt32(txtBurial.Text.Trim());
            _tainfo.CompassVisit = Convert.ToInt32(txtCompassionVisit.Text.Trim());
            _tainfo.ChildCare = Convert.ToInt32(txtChildCare.Text.Trim());
            _tainfo.PersonalLiability = Convert.ToInt32(txtPersonalLiability.Text.Trim());
            _tainfo.LEWAD = Convert.ToInt32(txtLEGWAD.Text.Trim());
            _tainfo.BagPerEffect = Convert.ToInt32(txtBaggagePerEffect.Text.Trim());
            _tainfo.BagDelay = Convert.ToInt32(txtBaggageDelay.Text.Trim());
            _tainfo.TravelDoc = Convert.ToInt32(txtTravelDoc.Text.Trim());
            _tainfo.DepositTripCancel = Convert.ToInt32(txtDepositTripCancel.Text.Trim());
            _tainfo.Curtailment = Convert.ToInt32(txtCurtailment.Text.Trim());
            _tainfo.TravelDelay = Convert.ToInt32(txtTravelDelay.Text.Trim());
            _tainfo.MissTravelConnection = Convert.ToInt32(txtMissedTravelConn.Text.Trim());
            _tainfo.TravelOverBook = Convert.ToInt32(txtTravelOverbooked.Text.Trim());
            _tainfo.PersonalMoney = Convert.ToInt32(txtPersonalMoney.Text.Trim());
            _tainfo.CreditCardLost = Convert.ToInt32(txtCCLostFraud.Text.Trim());
            _tainfo.FBHCP = Convert.ToInt32(txtFBHCP.Text.Trim());
            _tainfo.ACRR = Convert.ToInt32(txtAddCRCR.Text.Trim());
            _tainfo.Terrorism = Convert.ToInt32(txtTerrorism.Text.Trim());
            _tainfo.KidnapHostage = Convert.ToInt32(txtKidnap.Text.Trim());
            _tainfo.EmtelCharge = Convert.ToInt32(txtEmergencyTelCharges.Text.Trim());
            _tainfo.DMPB = Convert.ToInt32(txtDomesticMaid.Text.Trim());
            _tainfo.WeddingAppAcc = Convert.ToInt32(txtWeddingApps.Text.Trim());
            _tainfo.Golfer = Convert.ToInt32(txtGolfer.Text.Trim());
            _tainfo.Status = Convert.ToBoolean(chkTAStatus.Checked.ToString());

            _tainfo.TAInsId = _tainfodb.Insert(_tainfo);

            if (_tainfo.TAInsId > 0)
            {
                //clearProcess();
                lblMessage.Text = "Saved successfully!";

                pnlAge.Visible = true;
                pnlPremium.Visible = true;
                pnlAreaDDL.Visible = true;

                lblTAId.Text = _tainfo.TAInsId.ToString();
                ddlPolicyType.Enabled = false;
                
            }
            else
            {
                lblError.Text = "Saving failed!";
            }

            
            
        }
    }

    protected void lnkSummary_OnClick(object sender, EventArgs e)
    {
        if (pnlSummary.Visible == false)
        {
            pnlSummary.Visible = true;
            LoadSummary();
            lnkSummary.Text = "Hide Summary";
        }
        else
        {
            pnlSummary.Visible = false;
            lnkSummary.Text = "View Summary";
        }
    }

    private void LoadSummary()
    {
        TAQuoteResultDB _taquoteresultdb = new TAQuoteResultDB();

        DataTable dtResults = new DataTable();
        dtResults = _taquoteresultdb.GetTAQuoteResultDT(Convert.ToInt64(lblTAId.Text.ToString()), ddlPolicyType.SelectedValue.ToString());

        grvDetailsSummary.DataSource = dtResults;
        grvDetailsSummary.DataBind();

    }

    public void clearProcess()
    {
        lblTAId.Text = "0";
        ddlProviderCompanyName.SelectedValue = "-1";
        ddlPolicyType.SelectedValue = "-1";
        //ddlTripType.SelectedValue = "-1";
        ddlLevelOfCoverage.SelectedValue = "-1";
        txtPlanName.Text = "";
        //txtAnnualPremium.Text = "0";
        txtAdultLess70.Text = "0";
        txtAdultAbove70.Text = "0";
        txtDFPT.Text = "0";
        txtBereavement.Text = "0";
        txtMedExpLess70.Text = "0";
        txtMedExpAbove70.Text = "0";
        txtEmergencyMed.Text = "0";
        txtHospitalInc.Text = "0";
        txtBurial.Text = "0";
        txtCompassionVisit.Text = "0";
        txtChildCare.Text = "0";
        txtPersonalLiability.Text = "0";
        txtLEGWAD.Text = "0";
        txtBaggagePerEffect.Text = "0";
        txtBaggageDelay.Text = "0";
        txtTravelDoc.Text = "0";
        txtDepositTripCancel.Text = "0";
        txtCurtailment.Text = "0";
        txtTravelDelay.Text = "0";
        txtMissedTravelConn.Text = "0";
        txtTravelOverbooked.Text = "0";
        txtPersonalMoney.Text = "0";
        txtCCLostFraud.Text = "0";
        txtFBHCP.Text = "0";
        txtAddCRCR.Text = "0";
        txtTerrorism.Text = "0";
        txtKidnap.Text = "0";
        txtEmergencyTelCharges.Text = "0";
        txtDomesticMaid.Text = "0";
        txtWeddingApps.Text = "0";
        txtGolfer.Text = "0";
        chkTAStatus.Checked = true;

        btnSubmit.Text = "Submit";
        btnClear.Text = "Clear";
    }

    private void ShowTADetails(Int64 TAId, string CoverType)
    {
        TAQuoteResult _taquoteresult = new TAQuoteResult();
        TAQuoteResultDB _taquoteresultdb = new TAQuoteResultDB();
        _taquoteresult = _taquoteresultdb.GetTAQuoteResult(TAId, CoverType);

        if (_taquoteresult != null)
        {
            lblTAId.Text = _taquoteresult.TAInsId.ToString();
            ddlProviderCompanyName.SelectedValue = _taquoteresult.TACompanyId.ToString();
            ddlPolicyType.SelectedValue = _taquoteresult.PlanType.ToString();
            //ddlTripType.SelectedValue = _taquoteresult.TripType.ToString();
            ddlLevelOfCoverage.SelectedValue = _taquoteresult.CoverageLevel.ToString();
            txtPlanName.Text = _taquoteresult.PlanName;
            //txtAnnualPremium.Text = _taquoteresult.AnnualPremium.ToString();
            txtAdultLess70.Text = _taquoteresult.DTPD_LessYr70.ToString();
            txtAdultAbove70.Text = _taquoteresult.DTPD_AboveYr70.ToString();
            txtDFPT.Text = _taquoteresult.DeathPubTrans.ToString();
            txtBereavement.Text = _taquoteresult.Bereavement.ToString();
            txtMedExpLess70.Text = _taquoteresult.MedExp_LessYr70.ToString();
            txtMedExpAbove70.Text = _taquoteresult.MedExp_AboveYr70.ToString();
            txtEmergencyMed.Text = _taquoteresult.EmMedEval.ToString();
            txtHospitalInc.Text = _taquoteresult.HospIncome.ToString();
            txtBurial.Text = _taquoteresult.BCR.ToString();
            txtCompassionVisit.Text = _taquoteresult.CompassVisit.ToString();
            txtChildCare.Text = _taquoteresult.ChildCare.ToString();
            txtPersonalLiability.Text = _taquoteresult.PersonalLiability.ToString();
            txtLEGWAD.Text = _taquoteresult.LEWAD.ToString();
            txtBaggagePerEffect.Text = _taquoteresult.BagPerEffect.ToString();
            txtBaggageDelay.Text = _taquoteresult.BagDelay.ToString();
            txtTravelDoc.Text = _taquoteresult.TravelDoc.ToString();
            txtDepositTripCancel.Text = _taquoteresult.DepositTripCancel.ToString();
            txtCurtailment.Text = _taquoteresult.Curtailment.ToString();
            txtTravelDelay.Text = _taquoteresult.TravelDelay.ToString();
            txtMissedTravelConn.Text = _taquoteresult.MissTravelConnection.ToString();
            txtTravelOverbooked.Text = _taquoteresult.TravelOverBook.ToString();
            txtPersonalMoney.Text = _taquoteresult.PersonalMoney.ToString();
            txtCCLostFraud.Text = _taquoteresult.CreditCardLost.ToString();
            txtFBHCP.Text = _taquoteresult.FBHCP.ToString();
            txtAddCRCR.Text = _taquoteresult.ACRR.ToString();
            txtTerrorism.Text = _taquoteresult.Terrorism.ToString();
            txtKidnap.Text = _taquoteresult.KidnapHostage.ToString();
            txtEmergencyTelCharges.Text = _taquoteresult.EmtelCharge.ToString();
            txtDomesticMaid.Text = _taquoteresult.DMPB.ToString();
            txtWeddingApps.Text = _taquoteresult.WeddingAppAcc.ToString();
            txtGolfer.Text = _taquoteresult.Golfer.ToString();
            chkTAStatus.Checked = Convert.ToBoolean(_taquoteresult.Status.ToString());

            btnSubmit.Text = "Update";
            btnClear.Text = "Add New";
        }
    }


    #region Premium Info

    private void SelectCountryListPerArea(Int64 ARId)
    {
        AreaCountryInfoDB _areacountryinfodb = new AreaCountryInfoDB();
        DataTable _dtareacountries = _areacountryinfodb.GetAreaCountryInfoList(ARId, Convert.ToInt64(lblTAId.Text), ddlPolicyType.SelectedValue.ToString());

        //Response.Write("<script>window.alert('test" + _dtareacountries.Rows.Count.ToString() + "')</script>");

        if (_dtareacountries.Rows.Count > 0)
        {
            for (int i = 0; i < cblCountries.Items.Count; i++)
            {
                foreach (DataRow row in _dtareacountries.Rows)
                {
                    if (cblCountries.Items[i].Value == row["CountryId"].ToString())
                        cblCountries.Items[i].Selected = true;
                   
                }

            }
        }


    }

    protected void LoadAllCountries()
    {
        CountryInfoDB _countryinfodb = new CountryInfoDB();
        DataTable _dtcountries = _countryinfodb.GetCountryInfoList();

        cblCountries.DataSource = _dtcountries;
        cblCountries.DataTextField = "Description";
        cblCountries.DataValueField = "CountryId";
        cblCountries.DataBind();

        cblCountries.RepeatColumns = 5;
        cblCountries.RepeatDirection = RepeatDirection.Horizontal;
    }

    protected void LoadCountriesOnSelectedIndexChanged(object sender, EventArgs e)
    {
        updProgressAge.Visible = false;
        updProgressArea.Visible = true;
        updProgressPremium.Visible = false;

        lnkbtnSelectAll.Text = "select all countries";

        if (ddlAreaRegion.SelectedValue != "-1")
        {
            pnlPremium.Visible = true;
            LoadPremium();
            LoadAllCountries();
            SelectCountryListPerArea(Convert.ToInt64(ddlAreaRegion.SelectedValue.ToString()));
        }
        else
        {
            pnlArea.Visible = false;
            pnlPremium.Visible = false;
        }
    }
    
    protected void ShowCountries(object sender, EventArgs e)
    {
        updProgressAge.Visible = false;
        updProgressArea.Visible = true;
        updProgressPremium.Visible = false;

        lnkbtnSelectAll.Text = "select all countries";

        if (pnlArea.Visible == true)
        {
            pnlArea.Visible = false;
            lnkShowCountries.Text = "show countries";
        }
        else
        {
            lnkShowCountries.Text = "hide countries";
            pnlArea.Visible = true;
            LoadAllCountries();
            SelectCountryListPerArea(Convert.ToInt64(ddlAreaRegion.SelectedValue.ToString()));

        }
    }

    protected void SelectAllCountries(object sender, EventArgs e)
    {
        updProgressAge.Visible = false;
        updProgressArea.Visible = true;
        updProgressPremium.Visible = false;

        if (lnkbtnSelectAll.Text == "select all countries")
        {
            for (int i = 0; i < cblCountries.Items.Count; i++)
            {
                cblCountries.Items[i].Selected = true;
            }

            lnkbtnSelectAll.Text = "unselect all countries";
        }
        else
        {
            for (int i = 1; i < cblCountries.Items.Count; i++)
            {
                cblCountries.Items[i].Selected = false;
            }
            lnkbtnSelectAll.Text = "select all countries";
        }
           
       

    }

    protected void btnUpdateArea_Click(object sender, EventArgs e)
    {
        updProgressAge.Visible = false;
        updProgressArea.Visible = true;
        updProgressPremium.Visible = false;

        if (Page.IsValid)
        {
            AreaCountryInfo _areacountryinfo = new AreaCountryInfo();
            AreaCountryInfoDB _areacountryinfodb = new AreaCountryInfoDB();

            Int64 newacid = 0;
            _areacountryinfodb.CheckAreaCountryItem(Convert.ToInt64(ddlAreaRegion.SelectedValue.ToString()), Convert.ToInt64(lblTAId.Text), ddlPolicyType.SelectedValue.ToString());

            for (int i = 0; i < cblCountries.Items.Count; i++)
            {

                if (cblCountries.Items[i].Selected == true)
                {

                    _areacountryinfo.AreaCountryId = 0;
                    _areacountryinfo.AreaId = Convert.ToInt64(ddlAreaRegion.SelectedValue.ToString());
                    _areacountryinfo.CountryId = Convert.ToInt64(cblCountries.Items[i].Value.ToString());
                    _areacountryinfo.TaInsId = Convert.ToInt64(lblTAId.Text);
                    _areacountryinfo.PlanType = ddlPolicyType.SelectedValue.ToString();

                    _areacountryinfodb.Insert(_areacountryinfo);

                    newacid = _areacountryinfo.AreaCountryId;
                }

            }


            //if (newacid > 0)
            //    lblMessageArea.Text = "Saved successfully!";
            //else
            //    lblErrorArea.Text = "Saving failed!";

            lnkbtnSelectAll.Text = "select all countries";
        }
    }

    protected void LoadPremium()
    {
        updProgressAge.Visible = false;
        updProgressArea.Visible = false;
        updProgressPremium.Visible = true;

        TAPremiumDB _tapremiumdb = new TAPremiumDB();
        DataTable _dtPremium = new DataTable();

        //_dtPremium = _tapremiumdb.GetPremiumDTList(Convert.ToInt64(lblTAId.Text), Convert.ToInt64(ddlAreaRegion.SelectedValue.ToString()), ddlPolicyType.SelectedValue.ToString());
        _dtPremium = _tapremiumdb.GetPremiumDTList(Convert.ToInt64(lblTAId.Text), ddlPolicyType.SelectedValue.ToString(), ddlLevelOfCoverage.SelectedValue.ToString(), Convert.ToInt64(ddlAreaRegion.SelectedValue.ToString()));

        grvPremium.DataSource = _dtPremium;
        grvPremium.DataBind();
 
    }

    protected void grvPremium_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState & DataControlRowState.Edit) == 0))
        {
            LinkButton db = (LinkButton)e.Row.Cells[4].Controls[2];
            db.OnClientClick = string.Format("return confirm('Are you certain you want to delete premium {0} ?');", DataBinder.Eval(e.Row.DataItem, "Price").ToString());
        }
    }

    protected void grvPremium_RowEditing(object sender, GridViewEditEventArgs e)
    {
        grvPremium.EditIndex = e.NewEditIndex;
        LoadPremium();       
    }

    protected void grvPremium_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TAPremiumDB _tapremiumdb = new TAPremiumDB();
        TAPremium _tapremium = new TAPremium();

        _tapremium.TAPreId = Convert.ToInt64(((Label)grvPremium.Rows[e.RowIndex].FindControl("lblID")).Text);
        _tapremium.TAInsId = Convert.ToInt64(lblTAId.Text.ToString());
        _tapremium.AreaId = Convert.ToInt64(ddlAreaRegion.SelectedValue.ToString());
        _tapremium.DurationStart = Convert.ToInt32(((TextBox)grvPremium.Rows[e.RowIndex].FindControl("txtDurationStart")).Text);
        _tapremium.DurationEnd = Convert.ToInt32(((TextBox)grvPremium.Rows[e.RowIndex].FindControl("txtDurationEnd")).Text);
        _tapremium.Price = float.Parse(((TextBox)grvPremium.Rows[e.RowIndex].FindControl("txtPrice")).Text);

        _tapremiumdb.Insert(_tapremium, ddlPolicyType.SelectedValue.ToString());

        grvPremium.EditIndex = -1;
        LoadPremium();        
    }

    protected void grvPremium_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        grvPremium.EditIndex = -1;
        LoadPremium();        
    }

    protected void grvPremium_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int TAPreID;

        TAPreID = int.Parse(((Label)grvPremium.Rows[e.RowIndex].FindControl("lblID")).Text);

        TAPremiumDB _tapremiumdb = new TAPremiumDB();
        _tapremiumdb.Delete(TAPreID, ddlPolicyType.SelectedValue.ToString());

        LoadPremium();
    }

    protected void lnkbtnAddPremium_Click(object sender, EventArgs e)
    {
        //updProgressAge.Visible = false;
        //updProgressArea.Visible = false;
        //updProgressPremium.Visible = true;

        TAPremiumDB _tapremiumdb = new TAPremiumDB();
        TAPremium _tapremium = new TAPremium();

        _tapremium.TAPreId = 0;
        _tapremium.TAInsId = Convert.ToInt64(lblTAId.Text.ToString());
        _tapremium.AreaId = Convert.ToInt64(ddlAreaRegion.SelectedValue.ToString());
        _tapremium.DurationStart = Convert.ToInt32(txtDurationStartNew.Text.Trim());
        _tapremium.DurationEnd = Convert.ToInt32(txtDurationEndNew.Text.Trim());
        _tapremium.Price = float.Parse(txtPriceNew.Text.Trim());

        _tapremiumdb.Insert(_tapremium, ddlPolicyType.SelectedValue.ToString());

        grvPremium.EditIndex = -1;
        LoadPremium();

        txtDurationStartNew.Text = "0";
        txtDurationEndNew.Text = "0";
        txtPriceNew.Text = "0";
    }

    #endregion

    #region Age Eligibility

    protected void btnSaveAge_Click(object sender, EventArgs e)
    {
        updProgressAge.Visible = true;
        updProgressArea.Visible = false;
        updProgressPremium.Visible = false;

        TAAgeEligibility _taageeligibility = new TAAgeEligibility();
        TAAgeEligibilityDB _taageeligibilitydb = new TAAgeEligibilityDB();

        _taageeligibility.TAAgeId = Convert.ToInt64(lblTAAgeId.Text.Trim());
        _taageeligibility.TAInsId = Convert.ToInt64(lblTAId.Text.Trim());
        _taageeligibility.AdultAgeFrom = Convert.ToInt32(txtAdultAgeFrom.Text.Trim());
        _taageeligibility.AdultAgeTo = Convert.ToInt32(txtAdultAgeTo.Text.Trim());
        _taageeligibility.ChildAgeFrom = Convert.ToInt32(txtChildAgeFrom.Text.Trim());
        _taageeligibility.ChildAgeTo = Convert.ToInt32(txtChildAgeTo.Text.Trim());
        _taageeligibility.PlanType = ddlPolicyType.SelectedValue.ToString();

        _taageeligibility.TAAgeId = _taageeligibilitydb.Insert(_taageeligibility);

        if (_taageeligibility.TAAgeId > 0)
        {
            lblMessageAge.Text = "Saved successfully!";
        }
        else
        {
            lblErrorAge.Text = "Saving failed!";
        }

    }

    protected void LoadAgeEligibility()
    {
        TAAgeEligibility _taageeligibility = new TAAgeEligibility();
        TAAgeEligibilityDB _taageeligibilitydb = new TAAgeEligibilityDB();

        _taageeligibility = _taageeligibilitydb.GetAgeEligibilityDTItem(Convert.ToInt64(lblTAId.Text.Trim()), ddlPolicyType.SelectedValue.ToString());

        if (_taageeligibility != null)
        {
            lblTAAgeId.Text = _taageeligibility.TAAgeId.ToString();
            txtAdultAgeFrom.Text = _taageeligibility.AdultAgeFrom.ToString();
            txtAdultAgeTo.Text = _taageeligibility.AdultAgeTo.ToString();
            txtChildAgeFrom.Text = _taageeligibility.ChildAgeFrom.ToString();
            txtChildAgeTo.Text = _taageeligibility.ChildAgeTo.ToString();
        }
      
    }

    #endregion
}
